from flask import g, Blueprint, redirect, url_for, request, jsonify, session, render_template, Response

bp = Blueprint("visitor", __name__, url_prefix="/")


@bp.route("/")
def main():
    return render_template("login.html")


@bp.route("/index")
def index():
    content = {
        "admin": g.user,
    }
    return render_template("index.html", **content)


@bp.route("/results_cut")
def results_cut():
    content = {
        "admin": g.user,
    }
    return render_template("results_cut.html", **content)


@bp.route("/camera_management")
def camera_management():
    content = {
        "admin": g.user,
        "max_display_page": 5,
        "page_size": 10
    }
    return render_template("camera_management.html", **content)


@bp.route("/camera_form")
def camera_form():
    id_camera = request.values.get("id_camera")
    if id_camera is None:
        return redirect("/camera_management")

    content = {
        "admin": g.user,
    }
    return render_template("camera_form.html", **content)


@bp.route("/realtime")
def realtime():
    content = {
        "admin": g.user
    }
    return render_template("realtime.html", **content)
